import { AxiosPromise } from "axios";
import axios from "../axios";
import Iservice from "./IService";
import UserInfo from "./index";

class Service implements Iservice {
    query(params?: any): AxiosPromise {
        return axios({
            method: "get",
            url: "/api/users",
            params
        })
    }
    post(data?: UserInfo): AxiosPromise {
        return axios({
            method: "post",
            url: "/api/users/register",
            data
        })
    }
    del(id?: number): AxiosPromise {
        return axios({
            method: "delete",
            url: "/api/users/" + id
        })
    }
    login(data?: any): AxiosPromise {
        return axios({
            method: "post",
            url: "/api/users/login",
            data
        })
    }
}
export default new Service();